package main

import (
	"encoding/xml"
	"fmt"
	"io/ioutil"
)

type Device struct {
	XMLName xml.Name `xml:"devices"`
	Version string   `xml:"version,attr"`
	Host    []Host   `xml:"host"`
	Desc    string   `xml:",innerxml"`
}

type Host struct {
	XMLName  xml.Name `xml:"host"`
	HostName string   `xml:"hostName"`
	HostCode string   `xml:"hostCode"`
	HostDate string   `xml:"hostDate"`
	ID       int      `xml:"id,attr"`
}

func main() {
	var d Device
	data, _ := ioutil.ReadFile("./device.xml")
	xml.Unmarshal(data, &d)
	fmt.Println(d)
}
